package com.base.controller;

import com.base.entity.bo.TitleCategoryBo;
import com.base.entity.vo.TitleCategoryVo;
import com.base.service.TitleCategoryService;
import com.base.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "职称类别设置")
@RestController
@RequestMapping("/zclb")
public class TitleCategoryController {
    @Autowired
    TitleCategoryService titleCategoryService;

    @PostMapping("/titleCategoryList")
    @ApiOperation(value = "查询可选和已选职称类别")
    public Result titleCategoryList(@RequestBody TitleCategoryVo titleCategoryVo){
        List<TitleCategoryBo> list =titleCategoryService.titleCategoryList(titleCategoryVo);
        return Result.succ(list);
    }

    @PostMapping("/updateTitleCategory")
    @ApiOperation(value = "更新职称类别")
    public Result updateTitleCategory(@RequestBody TitleCategoryVo titleCategoryVo){
        int row=titleCategoryService.updateTitleCategory(titleCategoryVo);
        if (row > 0) {
            return Result.succ("新增成功");
        } else {
            return Result.fail("新增失败");
        }
    }
}
